﻿using System.Collections.Generic;
using System.Data;
using Smatime.Web.DAO.SmatimeDatasetTableAdapters;
using Smatime.Web.Models;

namespace Smatime.Web.DAO
{
    public class VisaExperationRepository :
        BaseRepository<VisaExperation, SmatimeDataset.TotalVisaExperationDataTable, TotalVisaExperationTableAdapter>
    {
        public IEnumerable<VisaExperation> GetTotalVisaExByID(int id)
        {
            using (var adapter = new TotalVisaExperationTableAdapter())
            {
                using (var table = adapter.GetDataBy(id))
                {
                    var list = new List<VisaExperation>();
                    foreach (DataRow row in table.Rows)
                    {
                        var totalVisaExp = new VisaExperation();
                        totalVisaExp.FromDataRow(row);
                        list.Add(totalVisaExp);
                    }
                    return list;
                }
            }
        }
    }
}